package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.CategoryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface CategoryMapper {
    Page<Category> pageQuery(String name, Integer type);
    @AutoFill(type = OperationType.UPDATE)
    void update(Category category);
    @AutoFill(type = OperationType.INSERT)
    @Insert("insert into category(name,sort,type,create_time,update_time,create_user,update_user) values (#{name},#{sort},#{type},   #{createTime},#{updateTime},#{createUser},#{updateUser})")
    void save(Category category);
    @Delete("delete from category where id=#{id}")
    void delete(Long id);
    List<Category> list(Integer type);
}
